﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;

public partial class Clients_Control_TabControl : System.Web.UI.UserControl
{
    private string cssTab = "ui-state-default ui-corner-top ui-tabs-selected ui-state-active";
    private string cssTabHide = "ui-state-default ui-corner-top";
    private string cssDiv = "ui-tabs-panel ui-widget-content ui-corner-top";
    private string cssDivHide = "ui-tabs-panel ui-widget-content ui-corner-top ui-tabs-hide";
    protected string liTag = string.Empty;
    protected string divTag = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        LoadCharacter();
    }

    private void LoadCharacter()
    {
        try
        {
            List<DataTest> list = new List<DataTest>();
            list.Add(new DataTest("Tinh Nang", "noi dung tab 1"));
            list.Add(new DataTest("tab1", "noi dung tab 2"));
            list.Add(new DataTest("tab1", "noi dung tab 3"));
            list.Add(new DataTest("tab1", "noi dung tab 4"));
            list.Add(new DataTest("tab1", "noi dung tab 5"));
            list.Add(new DataTest("tab1", "noi dung tab 6"));
            list.Add(new DataTest("tab1", "noi dung tab 7"));
            list.Add(new DataTest("tab1", "noi dung tab 8"));



            for (int i = 0; i < list.Count; i++)
            {

                if (i == ActiveIndexTab)
                {
                    liTag += BuildLiTag(list[i].TitleTab, i, cssTab);
                    divTag += BuildDivTag(list[i].ContentDiv, i, cssDiv);
                }
                else
                {
                    liTag += BuildLiTag(list[i].TitleTab, i, cssTabHide);
                    divTag += BuildDivTag(list[i].ContentDiv, i, cssDivHide);
                }
            }
            Literal1.Text = liTag;
            Literal2.Text = divTag;

        }
        catch
        {

        }

    }

    private string BuildLiTag(string content, int index, string css)
    {
        return "<li class=\"" + css + "\"><a href=\"#tabs-" + index + "\">" + content + "</a></li>";
    }

    private string BuildDivTag(string content, int index, string css)
    {
        return "<div id=\"tabs-" + index + "\" class=\"" + css + "\">" + content + "</div>";
    }

    public int ActiveIndexTab
    {
        set;
        get;
    }

}

class DataTest
{


    public DataTest(string tilte, string content)
    {
        TitleTab = tilte;
        ContentDiv = content;
    }
    public string TitleTab
    {
        get;

        set;
    }

    public string ContentDiv
    {
        get;

        set;
    }
}
